<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>贪吃蛇游戏</title>
    <style>
        body {
            display: flex;
            flex-direction: column;
            align-items: center;
            background-color: #f0f0f0;
            font-family: Arial, sans-serif;
        }
        canvas {
            border: 1px solid #000;
            background-color: #fff;
        }
        #score {
            font-size: 24px;
            margin: 10px 0;
        }
    </style>
</head>
<body>
    <h1>贪吃蛇游戏</h1>
    <div id="score">分数: 0</div>
    <button id="startButton">开始游戏</button>
    <canvas id="gameCanvas" width="800" height="600"></canvas>
    <style>
      #startButton {
        padding: 10px 20px;
        font-size: 18px;
        background-color: #4CAF50;
        color: white;
        border: none;
        border-radius: 5px;
        cursor: pointer;
        margin-bottom: 10px;
      }
      #startButton:hover {
        background-color: #45a049;
      }
    </style>
    <script type="module" src="game.js"></script>
    <script type="module">
        import { Game } from './game.js';
        const game = new Game();
        game.init();
    </script>
</body>
</html>